package com.mnnu.filter;

import jakarta.servlet.*;
import jakarta.servlet.annotation.WebFilter;

import java.io.IOException;

//@WebFilter(urlPatterns = "/*")
public class ABCFilter implements Filter { //形成过滤器链，执行顺序即为过滤器类排序顺序
    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        //放行前逻辑
        System.out.println("ABC放行前逻辑");

        //放行
        filterChain.doFilter(servletRequest, servletResponse);

        //放行后逻辑
        System.out.println("ABC放行后逻辑");
    }
}
